// clearAll(清除所有vuex数据)
const CLEAR_All=`CLEAR_All`;
// types
const SET_DATA = "SET_DATA"; // 设置列表数据
const VSIBLE_SWITCH = "VSIBLE_SWITCH"; // 二级弹窗显隐
// ---------------------------------------------------------------------------
const SET_BRANCH_DATA = "SET_BRANCH_DATA"; // 设置支行数据
const SET_BANK_DATA = "SET_BANK_DATA"; // 设置支行数据

// ---------------------------------------------------------------------------
const SET_AREA_ID = "SET_AREA_ID"; // 设置支行ID

const SET_BANK_ID = "SET_BANK_ID"; // 设置银行ID
// ---------------------------------------------------------------------------
// 设置行业分类
const SET_INDUSTRY_ID = "SET_INDUSTRY_ID"; // 设置行业分类ID
const SET_INDUSTRY_DATA = "SET_INDUSTRY_DATA"; // 设置行业分类数据

const SET_INDUSTRY_ID_TOG = "SET_INDUSTRY_ID_TOG"; // 设置行业分类ID
const SET_INDUSTRY_DATA_TOG = "SET_INDUSTRY_DATA_TOG"; // 设置行业分类数据
// ---------------------------------------------------------------------------
const SET_CLIENT_ID = "SET_CLIENT_ID"; // 设置商户ID
const SET_CLIENT_DATA = "SET_CLIENT_DATA"; // 设置商户数据
const SET_CHECKED_CLIENT_DATA = "SET_CHECKED_CLIENT_DATA"; // 设置已选商户列表
const SET_CHECKED_PAY_CHANNEL_DATA = "SET_CHECKED_PAY_CHANNEL_DATA"; // 设置已选支付通道列表
const SET_PAY_CHANNEL_ID = "SET_PAY_CHANNEL_ID"; // 设置支付通道ID
const SET_PAY_CHANNEL_DATA = "SET_PAY_CHANNEL_DATA"; // 设置支付通道数据
// ---------------------------------------------------------------------------
// 设置代理商
const SET_AGENT_DATA = "SET_AGENT_DATA"; // 设置代理商数据
const SET_AGENT_ID = "SET_AGENT_ID"; // 设置支行ID

const SET_AGENT_DATA_TOG = "SET_AGENT_DATA_TOG"; // 设置代理商数据
const SET_AGENT_ID_TOG = "SET_AGENT_ID_TOG"; // 设置支行ID
// ---------------------------------------------------------------------------
// 选择支付公司
const SET_PAY_COMPANY_ID = "SET_PAY_COMPANY_ID"; // 设置支付公司ID
const SET_PAY_COMPANY_DATA = "SET_PAY_COMPANY_DATA"; // 设置支付公司数据

const SET_PAY_COMPANY_ID_TOG = "SET_PAY_COMPANY_ID_TOG"; // 设置支付公司ID_TOG
const SET_PAY_COMPANY_DATA_TOG = "SET_PAY_COMPANY_DATA_TOG"; // 设置支付公司数据_TOG
// ---------------------------------------------------------------------------
// 选择备付金
const SET_PAYMENT_ID = "SET_PAYMENT_ID"; // 设置备付金账户ID
const SET_PAYMENT_DATA = "SET_PAYMENT_DATA"; // 设置备付金账户数据

const SET_PAYMENT_ID_TOG = "SET_PAYMENT_ID_TOG"; // 设置备付金账户ID_TOG
const SET_PAYMENT_DATA_TOG = "SET_PAYMENT_DATA_TOG"; // 设置备付金账户数据_TOG

// ---------------------------------------------------------------------------
// 选择银行
const SET_BANK_DATA_COM = "SET_BANK_DATA_COM"; // 设置银行数据
const SET_BANK_ID_COM = "SET_BANK_ID_COM"; // 设置银行ID

const SET_BANK_ID_COM_TOG = `SET_BANK_ID_COM_TOG`; //选择银行id
const SET_BANK_DATA_COM_TOG = `SET_BANK_DATA_COM_TOG`; //赋值银行数据

// ---------------------------------------------------------------------------

// 选择通道技术(技术方案)
const SET_TECHNOLOGY_DATA_COM = "SET_TECHNOLOGY_DATA_COM"; // 设置通道技术
const SET_TECHNOLOGY_ID_COM = "SET_TECHNOLOGY_ID_COM"; // 设置通道技术

const SET_TECHNOLOGY_DATA_COM_TOG = "SET_TECHNOLOGY_DATA_COM_TOG"; // 设置通道技术
const SET_TECHNOLOGY_ID_COM_TOG = "SET_TECHNOLOGY_ID_COM_TOG"; // 设置通道技术

// ---------------------------------------------------------------------------

// 选择代付通道
const SET_PAYFORCHANNEL_DATA_COM = "SET_PAYFORCHANNEL_DATA_COM"; // 设置代付通道
const SET_PAYFORCHANNEL_ID_COM = "SET_PAYFORCHANNEL_ID_COM"; // 设置代付通道

const SET_PAYFORCHANNEL_DATA_COM_TOG = "SET_PAYFORCHANNEL_DATA_COM_TOG"; // 设置代付通道
const SET_PAYFORCHANNEL_ID_COM_TOG = "SET_PAYFORCHANNEL_ID_COM_TOG"; // 设置代付通道

// ---------------------------------------------------------------------------
// 选择支行
const SET_BRANCH_DATA_COM = "SET_BRANCH_DATA_COM"; // 设置支行数据
const SET_BRANCH_ID_COM = "SET_BRANCH_ID_COM"; // 设置支行ID

const SET_BRANCH_DATA_COM_TOG = "SET_BRANCH_DATA_COM_TOG"; // 设置支行数据
const SET_BRANCH_ID_COM_TOG = "SET_BRANCH_ID_COM_TOG"; // 设置支行ID
// ---------------------------------------------------------------------------

export default {
    namespaced: true,
    state: {
        // ------------------------------------
        outerVisible: false, // 一级弹窗显隐
        innerVisible: false, // 二级弹窗显隐
        // ------------------------------------
        //  对应addFromData，editFromData,queryData
        openType: "",
        // ------------------------------------
        // 代理商
        agentDialog: false,
        agentId: "", // 代理商id
        agentData: [], // 代理商列表

        // 查询时
        agentIdQuery: "", // 代理商id
        agentDataQuery: [], // 代理商列表

        // 添加时
        agentIdAdd: "", // 代理商id
        agentDataAdd: [], // 代理商列表

        // 编辑时
        agentIdEdit: "", // 代理商id
        agentDataEdit: [], // 代理商列表
        // ------------------------------------
        // 行业分类
        industryDialog: false,
        industryId: [],
        industryData: [],

        // 查询时
        industryIdQuery: [],
        industryDataQuery: [],

        // 添加时
        industryIdAdd: [],
        industryDataAdd: [],

        // 编辑时
        industryIdEdit: [],
        industryDataEdit: [],
        // ------------------------------------
        //  支行列表
        branchData: [],
        areaId: "", //  支行id
        // ------------------------------------
        // 银行列表
        bankData: [],
        bankId: "", //  银行id
        // ------------------------------------

        // 商户
        clientDialog: false,
        clientData: [],
        clientId: "",
        // ------------------------------------
        //支付通道
        payChannelDialog: false,
        payChannelData: [],
        payChannelId: "",
        // ------------------------------------
        //备付金账户
        paymentDialog: false,
        paymentData: [],
        paymentId: "",

        // 查询时
        paymentDataQuery: [],
        paymentIdQuery: "",

        // 添加时
        paymentDataAdd: [],
        paymentIdAdd: "",

        // 编辑时
        paymentDataEdit: [],
        paymentIdEdit: "",
        // ------------------------------------
        //支付公司
        payCompanyDialog: false,
        payCompanyData: [],
        payCompanyId: "",

        // 查询时
        payCompanyDataQuery: [],
        payCompanyIdQuery: "",

        // 添加时
        payCompanyDataAdd: [],
        payCompanyIdAdd: "",

        // 编辑时
        payCompanyDataEdit: [],
        payCompanyIdEdit: "",
        // ------------------------------------
        // 已选商户列表
        checkedClientData: [],
        // 已选支付通道列表
        checkedPayChannelData: [],
        // ----------------------------
        // 选择银行
        bankComDialog: false, //选择银行弹窗
        bankComId: "", // 银行id
        BankComData: [], // 银行数据

        // 查询时
        bankComIdQuery: "", // 查询银行id
        BankComDataQuery: [], // 查询银行数据

        // 添加时
        bankComIdAdd: "", // 添加银行id
        BankComDataAdd: [], // 添加银行数据

        // 编辑时
        bankComIdEdit: "", // 编辑银行id
        BankComDataEdit: [], // 编辑银行数据
        // ------------------------------------

        // 选择通道技术（技术方案）
        TechnologyDialog: false, //选择通道技术
        TechnologyId: "", // 通道技术ID
        TechnologyDataArr: [], // 通道技术数据

        // 查询时
        TechnologyIdQuery: "", // 通道技术ID
        TechnologyDataArrQuery: [], // 通道技术数据

        // 添加时
        TechnologyIdAdd: "", // 通道技术ID
        TechnologyDataArrAdd: [], // 通道技术数据

        // 编辑时
        TechnologyIdEdit: "", // 通道技术ID
        TechnologyDataArrEdit: [], // 通道技术数据
        // ------------------------------------

        // 选择代付通道
        PayForChannelComDialog: false, //选择代付通道
        PayForChannelIdCom: "", // 代付通道id
        PayForChannelDataCom: [], // 代付通道data

        // 查询时
        PayForChannelIdComQuery: "", // 代付通道id
        PayForChannelDataComQuery: [], // 代付通道data

        // 添加时
        PayForChannelIdComAdd: "", // 代付通道id
        PayForChannelDataComAdd: [], // 代付通道data

        // 编辑时
        PayForChannelIdComEdit: "", // 代付通道id
        PayForChannelDataComEdit: [], // 代付通道data
        // ------------------------------------

        // 选择支行
        branchComDialog: false, //选择支行银行弹窗
        branchComId: "", // 选择支行
        BranchComData: [], // 支行数据

        // 查询时
        branchComIdQuery: "", // 选择支行
        BranchComDataQuery: [], // 支行数据

        // 添加时
        branchComIdAdd: "", // 选择支行
        BranchComDataAdd: [], // 支行数据

        // 编辑时
        branchComIdEdit: "", // 选择支行
        BranchComDataEdit: [], // 支行数据
        // -------------------------------
        clearDataArr:[
            "agentId",
            "agentIdQuery",
            "agentIdAdd",
            "agentIdEdit",

            "industryId",
            "industryIdQuery",
            "industryIdAdd",
            "industryIdEdit",

            "areaId",

            "bankId",

            "clientId",

            "payChannelId",

            "paymentId",
            "paymentIdQuery",
            "paymentIdAdd",
            "paymentIdEdit",

            "payCompanyId",
            "payCompanyIdQuery",
            "payCompanyIdAdd",
            "payCompanyIdEdit",

            "bankComId",
            "bankComIdQuery",
            "bankComIdAdd",
            "bankComIdEdit",

            "TechnologyId",
            "TechnologyIdQuery",
            "TechnologyIdAdd",
            "TechnologyIdEdit",

            "PayForChannelIdCom",
            "PayForChannelIdComQuery",
            "PayForChannelIdComAdd",
            "PayForChannelIdComEdit",

            "branchComId",
            "branchComIdQuery",
            "branchComIdAdd",
            "branchComIdEdit",

        ]
    },
    actions: {},
    getters: {
        // -------------------------------------------
        // 选择银行
        bankComDialog: state => state.bankComDialog,
        bankComId: state => state.bankComId,
        BankComData: state => state.BankComData,

        // 查询时
        bankComIdQuery: state => state.bankComIdQuery,
        BankComDataQuery: state => state.BankComDataQuery,

        // 添加时
        bankComIdAdd: state => state.bankComIdAdd,
        BankComDataAdd: state => state.BankComDataAdd,

        // 编辑时
        bankComIdEdit: state => state.bankComIdEdit,
        BankComDataEdit: state => state.BankComDataEdit,

        // -------------------------------------------
        //  选择备付金
        paymentDialog: state => state.paymentDialog,
        paymentData: state => state.paymentData,
        paymentId: state => state.paymentId,

        // 查询时
        paymentDataQuery: state => state.paymentDataQuery,
        paymentIdQuery: state => state.paymentIdQuery,

        // 添加时
        paymentDataAdd: state => state.paymentDataAdd,
        paymentIdAdd: state => state.paymentIdAdd,

        // 编辑时
        paymentDataEdit: state => state.paymentDataEdit,
        paymentIdEdit: state => state.paymentIdEdit,

        // -------------------------------------------
        // 选择支付公司
        payCompanyDialog: state => state.payCompanyDialog,
        payCompanyData: state => state.payCompanyData,
        payCompanyId: state => state.payCompanyId,

        // 查询时
        payCompanyDataQuery: state => state.payCompanyDataQuery,
        payCompanyIdQuery: state => state.payCompanyIdQuery,

        // 添加时
        payCompanyDataAdd: state => state.payCompanyDataAdd,
        payCompanyIdAdd: state => state.payCompanyIdAdd,

        // 编辑时
        payCompanyDataEdit: state => state.payCompanyDataEdit,
        payCompanyIdEdit: state => state.payCompanyIdEdit,
        // -------------------------------------------

        // 选择通道技术(技术方案)
        TechnologyDialog: state => state.TechnologyDialog,
        TechnologyId: state => state.TechnologyId,
        TechnologyDataArr: state => state.TechnologyDataArr,

        // 查询时
        TechnologyIdQuery: state => state.TechnologyIdQuery,
        TechnologyDataArrQuery: state => state.TechnologyDataArrQuery,

        // 添加时
        TechnologyIdAdd: state => state.TechnologyIdAdd,
        TechnologyDataArrAdd: state => state.TechnologyDataArrAdd,

        // 编辑时
        TechnologyIdEdit: state => state.TechnologyIdEdit,
        TechnologyDataArrEdit: state => state.TechnologyDataArrEdit,
        // ----------------------------------------------

        // 选择代付通道
        PayForChannelComDialog: state => state.PayForChannelComDialog,
        PayForChannelIdCom: state => state.PayForChannelIdCom,
        PayForChannelDataCom: state => state.PayForChannelDataCom,

        // 查询时
        PayForChannelIdComQuery: state => state.PayForChannelIdComQuery,
        PayForChannelDataComQuery: state => state.PayForChannelDataComQuery,

        // 添加时
        PayForChannelIdComAdd: state => state.PayForChannelIdComAdd,
        PayForChannelDataComAdd: state => state.PayForChannelDataComAdd,

        // 编辑时
        PayForChannelIdComEdit: state => state.PayForChannelIdComEdit,
        PayForChannelDataComEdit: state => state.PayForChannelDataComEdit,

        // ----------------------------------------------

        // 选择支行
        branchComDialog: state => state.branchComDialog,
        branchComId: state => state.branchComId,
        BranchComData: state => state.BranchComData,

        // 查询时
        branchComIdQuery: state => state.branchComIdQuery,
        BranchComDataQuery: state => state.BranchComDataQuery,

        // 添加时
        branchComIdAdd: state => state.branchComIdAdd,
        BranchComDataAdd: state => state.BranchComDataAdd,

        // 编辑时
        branchComIdEdit: state => state.branchComIdEdit,
        BranchComDataEdit: state => state.BranchComDataEdit,
        // -------------------------------------------
        outerVisible: state => state.outerVisible,
        innerVisible: state => state.innerVisible,

        branchData: state => state.branchData,
        bankData: state => state.bankData,
        // ----------------------------------------------
        //  选择代理商
        agentDialog: state => state.agentDialog,
        agentData: state => state.agentData,
        agentId: state => state.agentId,

        // 查询时
        agentIdQuery: state => state.agentIdQuery,
        agentDataQuery: state => state.agentDataQuery,

        // 添加时
        agentIdAdd: state => state.agentIdAdd,
        agentDataAdd: state => state.agentDataAdd,

        // 编辑时
        agentIdEdit: state => state.agentIdEdit,
        agentDataEdit: state => state.agentDataEdit,
        // ----------------------------------------------
        // 选择行业分类
        industryDialog: state => state.industryDialog,
        industryData: state => state.industryData,
        industryId: state => state.industryId,

        // 查询时
        industryIdQuery: state => state.industryIdQuery,
        industryDataQuery: state => state.industryDataQuery,

        // 添加时
        industryIdAdd: state => state.industryIdAdd,
        industryDataAdd: state => state.industryDataAdd,

        // 编辑时
        industryIdEdit: state => state.industryIdEdit,
        industryDataEdit: state => state.industryDataEdit,

        // ----------------------------------------------

        areaId: state => state.areaId,

        popupStates: state => state.popupStates,
        bankId: state => state.bankId,
        openType: state => state.openType,
        clientDialog: state => state.clientDialog,
        clientData: state => state.clientData,
        clientId: state => state.clientId,
        checkedClientData: state => state.checkedClientData,
        checkedPayChannelData: state => state.checkedPayChannelData,
        payChannelDialog: state => state.payChannelDialog,
        payChannelData: state => state.payChannelData,
        payChannelId: state => state.payChannelId
    },

    mutations: {
        test(state, payload){
        },
        // 清除所有的vuex数据
        [CLEAR_All](state, payload){
            state[payload.key] = payload.value;
        },
        [SET_DATA](state, payload) {
            state[payload.key] = payload.value;
        },
        [VSIBLE_SWITCH](state, payload) {
            if (payload.openType) {
                state.openType = payload.openType.toString();
            }
            state[payload.key] = payload.value;
        },
        ["CLEAR_SELECT"](state, payload) {
            state[payload.key] = "";
        },
        // ---------------------------------------------------
        // 设置支行数据
        [SET_BRANCH_DATA](state, payload) {
            state.branchData = payload.branchData;
        },
        // ---------------------------------------------------
        [SET_BANK_DATA](state, payload) {
            state.bankData = payload.bankData;
        },
        // -------------------------------------------------------
        //   设置代理商
        [SET_AGENT_DATA](state, payload) {
            state.agentData = payload.agentData;
        },
        [SET_AGENT_ID](state, payload) {
            state.agentId = payload.agentId;
            state.agentDialog = false;
        },
        [SET_AGENT_ID_TOG](state, payload) {

            state[payload.key] = payload.value;

            state[payload.dialog] = false;
        },
        [SET_AGENT_DATA_TOG](state, payload) {
            state[payload.key] = payload.data;
        },
        // -------------------------------------------------------
        // 设置行业分类
        [SET_INDUSTRY_DATA](state, payload) {
            state.industryData = payload.industryData;
        },
        [SET_INDUSTRY_ID](state, payload) {
            state.industryId = payload.industryId;
            state.industryDialog = false;
        },
        [SET_INDUSTRY_ID_TOG](state, payload) {

            state[payload.key] = payload.value;

            state[payload.dialog] = false;
        },
        [SET_INDUSTRY_DATA_TOG](state, payload) {
            state[payload.key] = payload.data;
        },
        // -------------------------------------------------------
        [SET_AREA_ID](state, payload) {
            state.areaId = payload.areaId;
            state.outerVisible = false;
        },
        [SET_BANK_ID](state, payload) {
            state.bankId = payload.bankId;
            state.innerVisible = false;
        },

        [SET_CLIENT_ID](state, payload) {
            state.clientId = payload.clientId;
            state.clientDialog = false;
        },
        [SET_CLIENT_DATA](state, payload) {
            state.clientData = payload.clientData;
        },
        [SET_CHECKED_CLIENT_DATA](state, payload) {
            state.checkedClientData = payload.data;
        },
        [SET_CHECKED_PAY_CHANNEL_DATA](state, payload) {
            state.checkedPayChannelData = payload.data;
        },
        [SET_PAY_CHANNEL_ID](state, payload) {
            state.payChannelId = payload.id;
            state.payChannelDialog = false;
        },
        [SET_PAY_CHANNEL_DATA](state, payload) {
            state.payChannelData = payload.data;
        },
        // -------------------------------------------------------
        //  选择支付公司（通道公司）
        [SET_PAY_COMPANY_ID](state, payload) {
            state.payCompanyId = payload.id;
            state.payCompanyDialog = false;
        },
        [SET_PAY_COMPANY_DATA](state, payload) {
            state.payCompanyData = payload.data;
        },
        [SET_PAY_COMPANY_ID_TOG](state, payload) {

            state[payload.key] = payload.value;

            state[payload.dialog] = false;
        },
        [SET_PAY_COMPANY_DATA_TOG](state, payload) {
            state[payload.key] = payload.data;
        },
        // -------------------------------------------------------
        // 选择备付金
        [SET_PAYMENT_ID](state, payload) {
            state.paymentId = payload.id;
            state.paymentDialog = false;
        },
        [SET_PAYMENT_DATA](state, payload) {
            state.paymentData = payload.data;
        },

        [SET_PAYMENT_ID_TOG](state, payload) {

            state[payload.key] = payload.value;

            state[payload.dialog] = false;
        },
        [SET_PAYMENT_DATA_TOG](state, payload) {
            state[payload.key] = payload.data;
        },
        // -------------------------------------------------------
        // 选择银行
        [SET_BANK_ID_COM](state, payload) {
            // 获取银行ID
            state.bankComId = payload.bankComId;
            // 关闭银行弹窗（自身作为组件时）
            state.bankComDialog = false;
        },
        [SET_BANK_DATA_COM](state, payload) {
            state.BankComData = payload.BankComData;
        },

        // 选择银行
        [SET_BANK_ID_COM_TOG](state, payload) {
            // 获取银行ID
            state[payload.key] = payload.value;
            // 关闭银行弹窗（自身作为组件时）
            state[payload.dialog] = false;
        },
        [SET_BANK_DATA_COM_TOG](state, payload) {
            state[payload.key] = payload.data;
        },
        // ---------------------------------------------------------

        // 选择通道技术(技术方案)
        [SET_TECHNOLOGY_ID_COM](state, payload) {
            // 获取通道技术
            state.TechnologyId = payload.TechnologyId;
            // 关闭通道技术（自身作为组件时）
            state.TechnologyDialog = false;
        },
        [SET_TECHNOLOGY_DATA_COM](state, payload) {
            state.TechnologyDataArr = payload.TechnologyDataArr;
        },
        [SET_TECHNOLOGY_ID_COM_TOG](state, payload) {

            state[payload.key] = payload.value;

            state[payload.dialog] = false;
        },
        [SET_TECHNOLOGY_DATA_COM_TOG](state, payload) {
            state[payload.key] = payload.data;
        },
        // ---------------------------------------------------------
        // 选择代付通道
        [SET_PAYFORCHANNEL_ID_COM](state, payload) {
            // 获取代付通道ID
            state.PayForChannelIdCom = payload.PayForChannelIdCom;
            // 关闭代付通道ID（自身作为组件时）
            state.PayForChannelComDialog = false;
        },
        [SET_PAYFORCHANNEL_DATA_COM](state, payload) {
            state.PayForChannelDataCom = payload.PayForChannelDataCom;
        },
        [SET_PAYFORCHANNEL_ID_COM_TOG](state, payload) {

            state[payload.key] = payload.value;

            state[payload.dialog] = false;
        },
        [SET_PAYFORCHANNEL_DATA_COM_TOG](state, payload) {
            state[payload.key] = payload.data;
        },
        // ---------------------------------------------------------
        // 选择支行
        [SET_BRANCH_ID_COM](state, payload) {
            // 选择支行
            state.branchComId = payload.branchComId;
            // 关闭支行弹窗（自身作为组件时）
            state.branchComDialog = false;
        },
        [SET_BRANCH_DATA_COM](state, payload) {
            state.BranchComData = payload.BranchComData;
        },
        [SET_BRANCH_ID_COM_TOG](state, payload) {

            state[payload.key] = payload.value;

            state[payload.dialog] = false;
        },
        [SET_BRANCH_DATA_COM_TOG](state, payload) {
            state[payload.key] = payload.data;
        }
        // -------------------------------------------------------

    },
    actions: {
        test({ state, commit }, value) {
            // commit("SET_BRANCH_DATA_COM", value);
        },
        // 清除所有vuex数据
        clearAll({ state, commit }, value) {
            commit("SET_BRANCH_DATA_COM", value);
        },
    }
};
